<?php
require_once 'AbstractFactory.php';
require_once 'BanGong.php';
require_once 'ZhanShen.php';
//具体工厂类 - 神舟笔记本厂
class ShenZhouComputer extends AbstractFactory
{
    //具体产品类实例化集合
    public static $classArr = [];
    //实例化具体产品对象
    public function createObj($type)
    {
        if (array_key_exists($type,self::$classArr)) {
            return self::$classArr[$type];
        }
        $class = '';
        switch ($type) {
            case '1': //神舟笔记本办公系列
                $class = new BanGong();
                break;
            case '2':   //神舟笔记本电脑战神系列
                $class = new ZhanShen();
                break;
        }
        self::$classArr[$type] = $class;
        return self::$classArr[$type];
    }
}
